using ShopPowerTemplate.Entities;


namespace ShopPowerTemplate.Services
{
    public class AuthenticationServiceBase : Service
    {
        public AuthenticationServiceBase(IEntitiesDB entitiesDB) : base(entitiesDB)
        {

        }

        //public virtual async Task<string> AddAuthenticationEntityFromLiveConnect(string liveConnectEmail, string liveConnectAccessCode)
        //{
        //    LiveIDService service = new LiveIDService();
        //    LiveConnectUserProfile profile = await service.GetUserProfileFromLiveConnect(liveConnectAccessCode);

        //    if (profile == null) return null;

        //    string email = profile.AccountEmail.ToLowerInvariant();

        //    if (email != liveConnectEmail) return null;

        //    string password = RandomPassword.Generate();

        //    Customer customer = _customerService.Find(email);
        //    bool customerExists = customer != null;

        //    if (!customerExists)
        //    {
        //        customer = new Customer();
        //        customer.IsInactive = false;
        //        customer.Email = email;
        //    }

        //    customer.LastName = profile.LastName;
        //    customer.FirstName = profile.FirstName;
        //    customer.LiveToken = profile.AccessToken;
        //    customer.Password = password;

        //    if (!customerExists) _customerService.Add(customer);
        //    else _customerService.Change(customer);

        //    return password;
        //}

    }
}
